package com.aizuda.boot.modules.business.approval.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 审批交接查询结果VO
 *
 * @Author sangyirong
 * @ClassName HandoverQueryVO
 * @Version 1.0
 * @Date 2025/7/28 15:30
 */
@Data
@Schema(description = "审批交接查询结果")
public class HandoverQueryVO {

    @Schema(description = "流程分类ID")
    private Long categoryId;

    @Schema(description = "流程分类code")
    private String categoryName;

    @Schema(description = "流程分类可交接任务数量")
    private Integer handoverNum;

    @Schema(description = "流程分类可交接任务信息")
    private HandoverTask handoverTask;

    @Data
    public static class HandoverTask {

        @Schema(description = "包含该用户的流程")
        private List<ProcessCategoryInfo> containUserProcesses;

        @Schema(description = "该用户发起的流程实例")
        private List<ProcessInstanceInfo> userInitiatedInstances;

        @Schema(description = "需要该用户审批的任务")
        private List<PendingTaskInfo> userPendingTasks;
    }

    /**
     * 流程分类信息
     */
    @Data
    @Schema(description = "流程分类信息")
    public static class ProcessCategoryInfo {
        @Schema(description = "流程ID")
        private Long processId;

        @Schema(description = "流程名称")
        private String processName;

        @Schema(description = "流程版本")
        private Integer processVersion;
    }

    /**
     * 流程实例信息
     */
    @Data
    @Schema(description = "流程实例信息")
    public static class ProcessInstanceInfo {
        @Schema(description = "实例ID")
        private Long instanceId;

        @Schema(description = "流程ID")
        private Long processId;

        @Schema(description = "流程名称")
        private String processName;

        @Schema(description = "实例编号")
        private String instanceNo;

        @Schema(description = "当前节点名称")
        private String currentNodeName;

        @Schema(description = "创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private String createTime;
    }

    /**
     * 待处理任务信息
     */
    @Data
    @Schema(description = "待处理任务信息")
    public static class PendingTaskInfo {
        @Schema(description = "任务ID")
        private Long taskId;

        @Schema(description = "实例ID")
        private Long instanceId;

        @Schema(description = "流程ID")
        private Long processId;

        @Schema(description = "流程名称")
        private String processName;

        @Schema(description = "任务名称")
        private String taskName;

        @Schema(description = "实例编号")
        private String instanceNo;

        @Schema(description = "创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private String createTime;
    }
}
